// 1 定义默认数据，后期可以从接口中获取
import {GET_SWIPER_IMG} from '../actionType'
import {GET_CLASSIFY} from '../actionType'
import {GET_IMG} from '../actionType'
const defaultState = {
  imgHeight:170,
  swiperList:[],
  classifyList:[],
  imgList:[],
}
// 2 创建和对外暴露一个函数 返回state
export default (state = defaultState,action)=>{
    let newState = JSON.parse(JSON.stringify(state))
    switch(action.type){
      case GET_SWIPER_IMG:
        newState.swiperList=action.payload.swiperList
        break;
      case GET_CLASSIFY:
        newState.classifyList = action.payload.classifyList
        break;
      case GET_IMG:
        newState.imgList = action.payload.imgList
        break;
        default:
        break;
    }
    return newState
}